<template>
  <div class="page">
    <div class="tab-content">
      <div class="tab-ul">
        <div class="tab-li"
             :class="{'active': tabIndex === 0}"
             @click="onTab(0)"
        >岗位</div>
        <div class="slide"></div>
        <div class="tab-li"
             :class="{'active': tabIndex === 1}"
             @click="onTab(1)"
        >人才</div>
        <div class="slide"></div>
        <div class="tab-li"
             :class="{'active': tabIndex === 2}"
             @click="onTab(2)"
        >关注</div>
        <div class="active-li" :style="activeLiStyle"></div>
      </div>
    </div>


    <div class="ul" v-if="tabIndex === 0">
      <div class="job-li" v-for="item in [1,23,4,5,6,7,8,9,10]">
        <JobPerson></JobPerson>
      </div>
    </div>
    <div class="ul" v-if="tabIndex === 1">
      <div class="job-li" v-for="item in [1,23,4,5,6,7,8,9,10]">
        <JobPerson></JobPerson>
      </div>
    </div>

    <div class="ul" v-if="tabIndex === 2">
      <template v-for="item in [1,23,4,5,6,7,8,9,10]">
        <FeedMine></FeedMine>
      </template>
    </div>
    <BTab></BTab>
  </div>
</template>

<script setup lang="ts">
import BTab from "../../components/BTab.vue";
import {computed, ref} from "vue";
import FeedMine from "../../components/FeedMine.vue";
import JobPerson from "../../components/JobPerson.vue";
const tabIndex = ref(0)

const onTab = (index:number) => {
  tabIndex.value = index;
}
const activeLiStyle = computed(() => {
  return {left: tabIndex.value *200 -2  + 'rpx'}
})

</script>

<style lang="scss" scoped>
.tab-content {
  position: sticky;
  top: 0;
  background: #ffffff;
  padding: 0 80rpx 30rpx;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  z-index: 9;
}

.tab-ul {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  .tab-li {
    width: 200rpx;
    height: 44rpx;
    font-size: 32rpx;
    font-weight: 300;
    color: #0D3333;
    line-height: 44rpx;
    text-align: center;
    z-index: 9;
    //cursor: pointer;
    &.active {
      color: #000000;
    }
  }
  .slide {
    width: 2rpx;
    height: 24rpx;
    background: rgba(0, 0, 0, 0.25);
  }
  .active-li {
    width: 200rpx;
    height: 16rpx;
    position: absolute;
    bottom: -5rpx;
    transition:all 0.2s ease-in-out;
    &:after {
      position: absolute;
      top: 0;
      left: 50%;
      transform: translateX(-50%);
      content: '';
      width: 156rpx;
      height: 16rpx;
      background: #24FAF6;
      border-radius: 20rpx;
    }
  }
}

.ul {
  display: grid;
  grid-template-columns: 1fr;
  padding: 32rpx;
  gap: 24rpx;
}

.receive-job {
  height: 80rpx;
  background: #FFFFFF;
  border-radius: 36rpx;
  border: 2rpx solid rgba(0,0,0,0.08);
  padding: 0 42rpx;
  .txt {
    font-size: 24rpx;
    font-weight: 500;
    color: #000000;
  }
  .num {
    min-width: 58rpx;
    height: 32rpx;
    font-size: 22rpx;
    font-weight: 400;
    color: #0D3333;
    line-height: 32rpx;
    padding: 0 16rpx;
    text-align: center;
    background: rgba(36, 250, 246, 0.38);
    border-radius: 12rpx;
    margin: 0 12rpx;
  }
}
.job-li {
  background: #FFFFFF;
  border-radius: 24rpx;
  border: 2rpx solid rgba(0,0,0,0.08);
}

</style>
